<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="person_info" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="staffMyselfUpSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/oa/humanresources/StaffMyselfDet?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 员工基本信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="岗位" prop="">
              {{person_info.role}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名" prop="person_name">
              <el-input v-model="person_info.person_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="出生年月" prop="person_birthday">
              <el-date-picker v-model="person_info.person_birthday" type="date" style='width:100%' value-format="yyyy-MM-dd" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="性别" prop="person_sex">
              {{person_info.person_sex}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="民族" prop="person_ethnic">
              <el-select style='width:100%' v-model="person_info.person_ethnic">
                <el-option label="汉族" value="汉族" />
                <el-option label="蒙古族" value="蒙古族" />
                <el-option label="回族" value="回族" />
                <el-option label="壮族" value="壮族" />
                <el-option label="维吾尔族" value="维吾尔族" />
                <el-option label="藏族" value="藏族" />
                <el-option label="苗族" value="苗族" />
                <el-option label="彝族" value="彝族" />
                <el-option label="布依族" value="布依族" />
                <el-option label="朝鲜族" value="朝鲜族" />
                <el-option label="满族" value="满族" />
                <el-option label="侗族" value="侗族" />
                <el-option label=" 瑶族" value=" 瑶族" />
                <el-option label="白族" value="白族" />
                <el-option label="土家族" value="土家族" />
                <el-option label="哈尼族" value="哈尼族" />
                <el-option label="哈萨克族" value="哈萨克族" />
                <el-option label="傣族" value="傣族" />
                <el-option label="黎族" value="黎族" />
                <el-option label="僳僳族" value="僳僳族" />
                <el-option label="佤族" value="佤族" />
                <el-option label="畲族" value="畲族" />
                <el-option label="拉祜族" value="拉祜族" />
                <el-option label="水族" value="水族" />
                <el-option label="东乡族" value="东乡族" />
                <el-option label="纳西族" value="纳西族" />
                <el-option label="景颇族" value="景颇族" />
                <el-option label="柯尔克孜族" value="柯尔克孜族" />
                <el-option label="土族" value="土族" />
                <el-option label="达斡尔族" value="达斡尔族" />
                <el-option label="仫佬族" value="仫佬族" />
                <el-option label="仡佬族" value="仡佬族" />
                <el-option label="羌族" value="羌族" />
                <el-option label="锡伯族" value="锡伯族" />
                <el-option label="布朗族" value="布朗族" />
                <el-option label="撒拉族" value="撒拉族" />
                <el-option label="毛南族" value="毛南族" />
                <el-option label="阿昌族" value="阿昌族" />
                <el-option label="普米族" value="普米族" />
                <el-option label="塔吉克族" value="塔吉克族" />
                <el-option label="怒族" value="怒族" />
                <el-option label="乌孜别克族" value="乌孜别克族" />
                <el-option label="俄罗斯族" value="俄罗斯族" />
                <el-option label="鄂温克族" value="鄂温克族" />
                <el-option label="德昂族" value="德昂族" />
                <el-option label="保安族" value="保安族" />
                <el-option label="裕固族" value="裕固族" />
                <el-option label="京族" value="京族" />
                <el-option label="基诺族" value="基诺族" />
                <el-option label="高山族" value="高山族" />
                <el-option label="塔塔尔族" value="塔塔尔族" />
                <el-option label="独龙族" value="独龙族" />
                <el-option label="鄂伦春族" value="鄂伦春族" />
                <el-option label="赫哲族" value="赫哲族" />
                <el-option label="门巴族" value="门巴族" />
                <el-option label="珞巴族" value="珞巴族" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="政治面貌" prop="person_politics">
              <el-select style='width:100%' v-model="person_info.person_politics">
                <el-option label="－－无－－" value='' />
                <el-option v-for="dict in l_pf" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="证件类别" prop="person_papercate">
              <el-select style='width:100%' v-model="person_info.person_papercate">
                <el-option label="－－无－－" value='' />
                <el-option v-for="dict in l_pt" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="证件号码" prop="person_paperno">
              <el-input v-model="person_info.person_paperno" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="照片上传（二寸免冠照片，小于10K）" prop="">
              <input type=file />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 登陆信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="用户登陆账号" prop="log_name">
              <el-input v-model="person_info.log_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="用户登陆密码" prop="log_pass">
              <el-input v-model="person_info.log_pass" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="重复密码" prop="">
              <el-input v-model="empty" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 员工通讯信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="家庭实际住址" prop="relation_address">
              <el-input v-model="s_relation.relation_address" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="邮编" prop="relation_zip">
              <el-input v-model="s_relation.relation_zip" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="电话" prop="relation_tel">
              <el-input v-model="s_relation.relation_tel" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手机" prop="relation_cel">
              <el-input v-model="s_relation.relation_cel" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="E-mail" prop="relation_email">
              <el-input v-model="s_relation.relation_email" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'StaffMyselfUp',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        person_info: {
          role: null,
          person_name: null,
          person_birthday: null,
          person_sex: null,
          person_ethnic: null,
          person_politics: null,
          person_papercate: null,
          person_paperno: null,
          log_name: null,
          log_pass: null,
        },
        s_relation: {
          relation_address: null,
          relation_zip: null,
          relation_tel: null,
          relation_cel: null,
          relation_email: null,
        },
        l_pf: [],
        l_pt: [],
        loading: false,
        rules: {
          person_name: [{
            required: true,
            message: "姓名不能为空",
            trigger: 'blur',
          }],
          relation_cel: [{
            required: true,
            message: "手机不能为空",
            trigger: 'blur',
          }],
          relation_email: [{
            required: true,
            message: "E-mail不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/humanresources/EmployeeAction/staffMyselfUp?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      staffMyselfUpSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/oa/humanresources/EmployeeAction/staffMyselfUpSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/oa/humanresources/StaffMyselfDet/staffMyselfDet?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
